<?php $this->load->view('Admin/navbar');?>
  <!-- Tab panes -->
  <div class="tab-content" style="margin-top: 10px;">
    <div role="tabpanel" class="tab-pane" id="rebuild">
    <div class="panel panel-default">
		  <!-- Default panel contents -->
		  <div class="panel-heading">数据重建条件</div>
		  <div class="panel-body">
		    <p>
			    此程序用在数据出现错误需要重新计算金额时，如无必要不要频繁执行此程序，避免在使用高峰期执行，涉及的运算量比较大。<br>
			    此程序使用规则是何种金额出现错误就重新计算何种金额。例如汇总金额出现错误重新计算汇总金额，单店金额出现问题重新计算单店金额。
		    </p>
				  <div class="col-sm-10 col-md-offset-2">
				  	<form class="form-horizontal" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
				  		<div class="form-group">
						    <label for="dataType" class="col-sm-2 control-label">数据类型：</label>
						    <div class="col-sm-6">
						    	<select required class="form-control" id="dataType" name="dataType">
							      <option value="">请选择</option>
							      <?php foreach ($dataTypeCon as $k => $v) {?>
							      <option value="<?=$k?>" <?=$k==$where['dataType'] ? 'selected' :''?>><?=$v?></option>
							      <?php } ?>
								</select>
						    </div>
						 </div>
				  		<div class="form-group">
						    <label for="year" class="col-sm-2 control-label">年份：</label>
						    <div class="col-sm-4">
						    	<select required class="form-control" id="year" name="year">
							      <option value="">请选择</option>
								</select>
						    </div>
						 </div>
						 <div class="form-group">
						    <label for="month" class="col-sm-2 control-label">时段：</label>
						    <div class="col-sm-4">
						    	<select required class="form-control" id="timeUnit" name="timeUnit">
							      <option value="">请选择</option>
								</select>
						    </div>
						 </div>
						 <div class="form-group">
						    <label for="updateNum" class="col-sm-2 control-label">指定ID：</label>
						    <div class="col-sm-8">
						    	<input type="text" class="form-control" value="" id="ids" name="ids" placeholder="ID集">
						    	<p class="help-block">多个请使用[,]号隔开，不限中英文逗号</p>
						    </div>
						 </div>
						 <div class="form-group text-center">
						 	<button type="submit" class="btn btn-default btn-primary">开始计算</button>
						</div>
				  	</form>
				  </div>
				</div>
		  </div>
    </div>
</div>
<script type="text/javascript">
$(function(){
	loadYearList('year',<?=$where['year'] ? $where['year'] : 0?>);
	loadTimeUnitList('timeUnit',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>);
	initValidation();
});
function newWindowReload(){
	//alert('执行成功！！');
}

	//初始化验证
function initValidation(){
	$('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
	$('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
	    preventSubmit:false,
	    submitSuccess: function (form, event) {
	         event.preventDefault();
	         newWindow("执行情况",'<?php echo $this->input->server('REQUEST_URI'); ?>&runing=1&dataType='+$("#dataType").val()+'&year='+$("#year").val()+'&timeUnit='+$("#timeUnit").val()+"&ids="+$("#ids").val());
	         //ajaxFormSubmit('add');
	     },
	     submitError: function (form, event, errors) {
	       event.preventDefault();
	       }
  	});
}
</script>
<?php $this->load->view('Admin/foot');?>